package com.wanjl.mq.config;


import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author WanJl
 * @version 1.0
 * @title BindingConfig
 * @description RabbitMQ绑定交换机和队列关系的配置类
 * @create 2025/2/10
 */
@Configuration
public class BindingConfig {

    /**
     * 绑定队列和交换机
     * @param fanoutQueue01
     * @param fanoutExchange
     * @return
     */
    @Bean
    public Binding fanoutBinding01(Queue fanoutQueue01, FanoutExchange fanoutExchange) {
        return BindingBuilder.bind(fanoutQueue01).to(fanoutExchange);
    }
    /**
     * 绑定队列和交换机
     * @param fanoutQueue02
     * @param fanoutExchange
     * @return
     */
    @Bean
    public Binding fanoutBinding02(Queue fanoutQueue02, FanoutExchange fanoutExchange) {
        return BindingBuilder.bind(fanoutQueue02).to(fanoutExchange);
    }

}
